package org.example;

// 水果工厂类
public class FruitFactory {
    public Fruit createFruit(String type) {
        switch (type.toLowerCase()) {
            case "apple":
                return new Apple();
            case "banana":
                return new Banana();
            case "orange":
                return new Orange();
            default:
                throw new IllegalArgumentException("未知的水果类型: " + type);
        }
    }
} 